﻿using UnityEngine;
using UnityEngine.UI;
using HKTools;

public class Test_UIFrameSequence : MonoBehaviour
{
    [SerializeField] Button btn_FramesStartLoop;
    [SerializeField] Button btn_FramesStartOnce;
    [SerializeField] Button btn_FramesEnd;
    [SerializeField] Button btn_SimpleFramesOnce;
    [SerializeField] Button btn_SimpleFramesLoop;
    [SerializeField] Button btn_SimpleFramesStop;

    [SerializeField] HK_FrameSequence frameSequence;
    [SerializeField] HK_SimpleFrameSequence simpleFrameSequence;

    void Start()
    {
        btn_FramesStartLoop.onClick.AddListener(() =>
        {
            frameSequence.StartFramesAnim(true);
        });

        btn_FramesStartOnce.onClick.AddListener(() =>
        {
            frameSequence.StartFramesAnim(false);
        });

        btn_FramesEnd.onClick.AddListener(() =>
        {
            frameSequence.StopFramesAnim();
        });

        btn_SimpleFramesOnce.onClick.AddListener(() =>
        {
            // 单次播放
            simpleFrameSequence.StartFramesAnim(false);
        });

        btn_SimpleFramesLoop.onClick.AddListener(() =>
        {
            // 循环播放
            simpleFrameSequence.StartFramesAnim(true);
        });

        btn_SimpleFramesStop.onClick.AddListener(() =>
        {
            // 停止播放 
            simpleFrameSequence.StopFramesAnim();
        });
    }
}
